<template>
	<view class="destroy">
		<view class="destroy-top">
			<block-progress :width="350" :percent="destroy_warehouse" :label="'zkb'" :color="color"></block-progress>
		</view>
		<!-- #ifdef APP-PLUS -->
		<news-flow :type="3"></news-flow>
		<!-- #endif -->
		<view class="rule">
			<view class="title">
				<text>销毁中心说明</text>
			</view>
			<view class="rule-content">
				<rich-text :nodes="detail.content"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	import BlockProgress from "@/components/BlockProgress/BlockProgress.vue"
	import {getAllConfig,getRules} from "@/api/entrance.js"
	export default{
		name:"destroy",
		components:{
			BlockProgress
		},
		data(){
			return{
				color:['#333','#F4BD7D','#CC6B33'],
				destroy_warehouse:0,
				detail:{}
			}
		},
		onLoad() {
			this.getConfig()
			this.getAgreement();
		},
		methods:{
			async getAgreement(){
				let res = await getRules({
					keyword:'destroy_rule'
				})
				if(res.code ===1){
					if(res.data.length){
						res.data[0].content = res.data[0].content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;" ')
						this.detail = res.data[0]
					}
				}
			},
			async getConfig(){
				let res = await getAllConfig({type:2});
				if(res.code === 1){
					res.data.forEach((item)=>{
						if(item.keyword=='destroy_warehouse'){
							this.destroy_warehouse = Number(item.value).toFixed(3)
						}
					})
				}
			}
		}
	}
</script>

<style lang="less" scoped src="./destroy.less">
</style>
